<!doctype html>
<html>
<head>
<meta charset="UTF-8" />
<title>评论回复-最美乡村</title>  
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=0" />
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="format-detection" content="telephone=no">
<link rel="stylesheet" type="text/css" href="__PUBLIC__/wx/css/base.css" />
<link rel="stylesheet" type="text/css" href="__PUBLIC__/wx/css/detail.css" />
</head>
<body>
<div class="Article">
    <div class="comment">
    	<ul>
        	<li>
            	<div class="pic">
                    <eq name="info.img" value="">
                <img src="__PUBLIC__/wx/images/pic06.jpg"/>
                    <else/>
                <img src="__PUBLIC__/Uploads/{$info.img}"/>
                    </eq>
                </div>
                <div class="matter">
                	<h4><span>{$info.nickname}</span><!--<b>地方贤达</b>--><em class="praise" data="{$info.comments_id}" sup="{$info.comments_supports}">{$info.comments_supports}</em></h4>
                    <p>{$info.content}</p>
        <volist name="com" id="vo">
                    <h5><time>{$vo.addtime|date='Y-m-d',###}</time></h5>
                    <h6><span><b>{$vo.nickname} </b>回复 <b>{$info.nickname}：</b><em>{$vo.content}</em></span><!--<i>回复</i>--></h6> 
         </volist>   
            	</div>
            </li> 
        </ul>
    </div>
    <div class="apply"><p><input type="hidden" value="{$info.u_id}" name="r_u_id" /><input type="hidden" value="{$info.comments_id}" name="rid" /><input type="text" name="do-comments" placeholder="写评论"/><input type="button" value="发表" onClick="add_comments()"/></p></div>
</div>
	<script type="text/javascript" src="__PUBLIC__/wx/js/jquery-1.3.1.min.js"></script>
	<script type="text/javascript">
$(".praise").click(function(){
	id=$(this).attr('data');//获取点赞的id
	if($(this).hasClass("praised")){
		$.get("__MODULE__/Article/comments_supports/id/"+id+"/dowhat/dec/");
		$(this).text(Number($(this).attr('sup')));
		$(this).removeClass("praised");
	}else{
		$.get("__MODULE__/Article/comments_supports/id/"+id+"/dowhat/add/");
		$(this).text(Number($(this).attr('sup'))+1);
		$(this).addClass("praised");
		}
});
//评论
function add_comments(){
	if($("input[name='do-comments']").val()==''){alert("请输入评论！");return;}
	//增加，更新地址
    $.ajax({
    type : "POST",
    dataType : "json",
	data:{r_u_id:$("input[name='r_u_id']").val(),arc_type:'{$info.arc_type}',arc_id:'{$info.arc_id}',r_id:$("input[name='rid']").val(),content:$("input[name='do-comments']").val()},
    url: "__MODULE__/Article/comments/",
    async:false,
    success: function(data){
		if(data=='ok'){
			alert("添加成功");
			location.reload();
			}else{
				alert(data);
			}
    }
	});//end ajax
}//end
	</script>
</body>
</html>